package zd.cornermemory.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;

import zd.cornermemory.R;

/**
 * 授权用户协议、隐私政策
 */
public class FirstActivity extends BaseActivity implements View.OnClickListener{

    private TextView to_main;
    private TextView yhxy;
    private TextView yszc;
    private CheckBox check;
    private Toast    toast;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);
        to_main = findViewById(R.id.to_main);
        yhxy = findViewById(R.id.yhxy);
        yszc = findViewById(R.id.yszc);
        check = findViewById(R.id.check);
        toast = Toast.makeText(mContext,getString(R.string.check_first),Toast.LENGTH_SHORT);
        to_main.setOnClickListener(this);
        yhxy.setOnClickListener(this);
        yszc.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        Intent intent = null;
        switch (view.getId()) {
            case R.id.to_main:
                if (!check.isChecked()) {
                    toast.show();
                }else {
                    intent = new Intent(mContext, MainActivity.class);
                    startActivity(intent);
                    finish();
                }
                break;
            case R.id.yhxy:
                intent = new Intent(mContext, AgreementActivity.class);
                startActivity(intent);
                break;
            case R.id.yszc:
                intent = new Intent(mContext, PrivacyActivity.class);
                startActivity(intent);
                break;
        }
    }
}
